/**
 * 
 */
package fr.miage.shopping.metier.impl;

import java.util.List;



import fr.miage.shopping.dao.traitements.ClientDao;
import fr.miage.shopping.metier.ClientBusinessService;
import fr.miage.shopping.metier.entite.Client;

/**
 * @author romain, kristela
 * 
 */
public class ClientBusinessServiceImpl implements
		ClientBusinessService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3370466108771595750L;

	/**
	 * @see fr.miage.client.metier.client.ClientBusinessService#createClient(java.lang.String)
	 */
	public void createClient(Client clientTmp) {
		//Client c = ClientDao.selectClient(clientTmp);
		//if (c == null) {
			ClientDao.insertClient(clientTmp);
		//}
	}

	@Override
	public void deleteClient(int idClient) {
		ClientDao.deleteClient(idClient);

	}

	@Override
	public void modifyClient(Client oldClient, Client newclient) {
		Client c = ClientDao.selectClient(oldClient);
		if (c != null && oldClient.getIdClient() == newclient.getIdClient()) {
			ClientDao.insertClient(newclient);
		}

	}

	@Override
	public List<Client> getAllClient() {
		List<Client> listClient=ClientDao.selectAllClient();
		return listClient;
	}

	@Override
	public Client getClient(Client client) {
		Client c=ClientDao.selectClient(client);
		return c;
	}

}
